package nccloud.pubimpl.erm.expenseaccount.jkbx;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import nc.bs.dao.BaseDAO;
import nc.bs.er.fysq.ctrl.ERMBillVOUtil;
import nc.bs.erm.util.CacheUtil;
import nc.bs.erm.util.ERMPfUtil;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.bs.framework.exception.ComponentException;
import nc.bs.logging.Logger;
import nc.bs.pub.filesystem.FileSystemUtil;
import nc.bs.sec.esapi.NCESAPI;
import nc.bs.sscrp.tools.SqlUtils;
import nc.itf.arap.prv.IBXBillPrivate;
import nc.itf.arap.pub.IBXBillPublic;
import nc.itf.imag.lightbus.IImagPubService;
import nc.itf.sscivm.service.IIVMInvoiceInterfaceService;
import nc.itf.uap.IUAPQueryBS;
import nc.itf.uap.busibean.SysinitAccessor;
import nc.jdbc.framework.SQLParameter;
import nc.jdbc.framework.processor.ArrayListProcessor;
import nc.jdbc.framework.processor.ArrayProcessor;
import nc.nccloud.dto.erm.expenseaccount.BXBillVO;
import nc.nccloud.dto.erm.expenseaccount.JKBillVO;
import nc.nccloud.dto.erm.expenseaccount.NCFileVOResultSetProcessor;
import nc.nccloud.pub.erm.expenseaccount.AbstractBillDefValue;
import nc.nccloud.pub.erm.expenseaccount.jkbx.JKBXBillDefValue;
import nc.nccloud.util.erm.expenseaccount.ERMReimResultVO;
import nc.nccloud.util.erm.expenseaccount.ERMValueCheck;
import nc.nccloud.util.erm.expenseaccount.RequestParam;
import nc.nccloud.util.erm.webpub.ERMReimRuleUtil;
import nc.pubitf.bd.accessor.GeneralAccessorFactory;
import nc.pubitf.bd.accessor.IGeneralAccessor;
import nc.pubitf.erm.matterapp.IErmMatterAppBillQuery;
import nc.pubitf.para.SysInitQuery;
import nc.pubitf.para.SysInitQueryForNcc;
import nc.pubitf.uapbd.IBankaccPubQueryService;
import nc.vo.bd.accessor.IBDData;
import nc.vo.bd.accessor.NullGeneralAccessor;
import nc.vo.bd.accessor.bankaccsub.BankaccSubGeneralAccessor;
import nc.vo.bd.accessor.currtype.CurrtypeGeneralAccessor;
import nc.vo.bd.bankaccount.BankAccbasVO;
import nc.vo.ep.bx.BXBusItemVO;
import nc.vo.ep.bx.BXVO;
import nc.vo.ep.bx.BxcontrastVO;
import nc.vo.ep.bx.JKBXVO;
import nc.vo.ep.bx.JKVO;
import nc.vo.ep.dj.ERMDjCondVO;
import nc.vo.er.exception.ExceptionHandler;
import nc.vo.erm.accruedexpense.AccruedVerifyVO;
import nc.vo.erm.costshare.CShareDetailVO;
import nc.vo.erm.matterapp.AggMatterAppVO;
import nc.vo.erm.matterapp.MatterAppVO;
import nc.vo.jcom.lang.StringUtil;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.AggregatedValueObject;
import nc.vo.pub.BusinessException;
import nc.vo.pub.SuperVO;
import nc.vo.pub.filesystem.NCFileVO;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
import ncc.tool.erm.attachment.util.NCCImageUtil;
import nccloud.pubitf.erm.expenseaccount.IWebPubService;
import nccloud.pubitf.erm.expenseaccount.jkbx.IExpenseaccountService;
import nccloud.pubitf.platform.meta.IMetaQueryService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.codehaus.jettison.json.JSONObject;

public class ExpenseaccountServiceImpl implements IExpenseaccountService {
	public BXBillVO tempSaveJKBX(BXBillVO bill, RequestParam request) throws Exception {
		JKBXVO[] rtnVOArr = null;
		JKBXVO cvo = bill.toBXVO();
		JKBXVO jkbxvo = new BXVO();
		String pk_tradetype = cvo.getParentVO().getDjlxbm();
		String status = (String) request.getParameter("uistate") == null
				? (String) request.getParameter("status")
				: (String) request.getParameter("uistate");
		String ntbCheck = (String) request.getParameter("ntbCheck");
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		String jkCheck = (String) request.getParameter("jkCheck");
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		String imageUploadCheck = (String) request.getParameter("imageUploadCheck");
		cvo.getParentVO().setDjzt(0);
		if (pk_tradetype.startsWith("264")) {
			jkbxvo = cvo;
		} else if (pk_tradetype.startsWith("263")) {
			jkbxvo = cvo;
		}

		if (bill.getParentVO().getAttributeValue("imag_status") != null) {
			bill.getParentVO().setAttributeValue("imag_status", (Object) null);
		}

		this.setBillSrcSystem(jkbxvo);
		this.setBillStatus(jkbxvo, status);
		if ("true".equals(ntbCheck)) {
			jkbxvo.setHasNtbCheck(Boolean.TRUE);
		}

		if ("true".equals(proBudgetCheck)) {
			jkbxvo.setHasProBudgetCheck(Boolean.TRUE);
		}

		if ("true".equals(jkCheck)) {
			jkbxvo.setHasJkCheck(Boolean.TRUE);
		}

		if (!"264a".equals(pk_tradetype)) {
			this.calculateShareRatio(jkbxvo);
		}

		if ("edit".equals(status)) {
			jkbxvo.setContrastUpdate(true);
			rtnVOArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{jkbxvo});
		} else {
			if (!StringUtils.isEmpty(accessorybillid)) {
				jkbxvo.getParentVO().setPk_jkbx(accessorybillid);
			} else if (!StringUtils.isEmpty(msg_pk_bill) && StringUtils.isEmpty(jkbxvo.getParentVO().getPk_jkbx())) {
				jkbxvo.getParentVO().setPk_jkbx(msg_pk_bill);
			}

			rtnVOArr = this.getIBXBillPublic().tempSave(new JKBXVO[]{jkbxvo});
		}

		UFBoolean isUseImage = SysInitQueryForNcc.getParaBoolean(InvocationInfoProxy.getInstance().getGroupId(),
				"ER28");
		if (rtnVOArr != null && rtnVOArr.length > 0 && isUseImage != null && isUseImage.booleanValue()
				&& "true".equals(imageUploadCheck)) {
			NCCImageUtil.ybzImageBind(rtnVOArr[0]);
		}

		String pk_jkbx = jkbxvo.getParentVO().getPk_jkbx();
		((IWebPubService) NCLocator.getInstance().lookup(IWebPubService.class)).deleteSysFile(pk_jkbx, "1");
		JKBXVO returnVO = rtnVOArr[0];
		if (returnVO.getBxBusItemVOS() != null && returnVO.getBxBusItemVOS().length > 0) {
			ERMBillVOUtil.dealVODigit(returnVO);
		}

		new BXBillVO();
		BXBillVO revo = BXBillVO.getBXBillVO(returnVO);
		return revo;
	}

	public BXBillVO saveJKBX(BXBillVO bill, RequestParam request) throws Exception {
		JKBXVO[] rtnVOArr = null;
		JKBXVO cvo = bill.toBXVO();
		JKBXVO jkbxvo = new BXVO();
		String pk_tradetype = cvo.getParentVO().getDjlxbm();
		String status = (String) request.getParameter("uistate") == null
				? (String) request.getParameter("status")
				: (String) request.getParameter("uistate");
		String ntbCheck = (String) request.getParameter("ntbCheck");
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		String jkCheck = (String) request.getParameter("jkCheck");
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		String imageUploadCheck = (String) request.getParameter("imageUploadCheck");
		String templateId = request.getParameter("templateid") == null
				? null
				: request.getParameter("templateid").toString();
		if (pk_tradetype.startsWith("264")) {
			jkbxvo = cvo;
		} else if (pk_tradetype.startsWith("263")) {
			jkbxvo = cvo;
		}

		if (((JKBXVO) jkbxvo).getParentVO().getDjzt() != null && ((JKBXVO) jkbxvo).getParentVO().getDjzt() == 0) {
			((JKBXVO) jkbxvo).getParentVO().setDjzt(1);
		}

		if (bill.getParentVO().getAttributeValue("imag_status") != null) {
			bill.getParentVO().setAttributeValue("imag_status", (Object) null);
		}

		ERMReimResultVO[] RemresultVOS = this.loadReim((JKBXVO) jkbxvo, (String) request.getParameter("pagecode"),
				(String) request.getParameter("appcode"), -1, (Map) null, templateId);
		if (RemresultVOS != null && RemresultVOS.length > 0) {
			String reimmsg = RemresultVOS[0].getMsg();
			request.setParameter("reimmsg", reimmsg);
		}

		this.filterBusitemVO((JKBXVO) jkbxvo);
		if (!((JKBXVO) jkbxvo).getParentVO().isAdjustBxd()) {
			jkbxvo = this.completMtappInfo((JKBXVO) jkbxvo);
		}

		this.setBillSrcSystem((JKBXVO) jkbxvo);
		this.setBillStatus((JKBXVO) jkbxvo, status);
		if ("true".equals(ntbCheck)) {
			((JKBXVO) jkbxvo).setHasNtbCheck(Boolean.TRUE);
		}

		if ("true".equals(proBudgetCheck)) {
			((JKBXVO) jkbxvo).setHasProBudgetCheck(Boolean.TRUE);
		}

		if ("true".equals(jkCheck)) {
			((JKBXVO) jkbxvo).setHasJkCheck(Boolean.TRUE);
		}

		if (!"264a".equals(pk_tradetype)) {
			this.calculateShareRatio((JKBXVO) jkbxvo);
		}

		if ("edit".equals(status)) {
			((JKBXVO) jkbxvo).setContrastUpdate(true);
			rtnVOArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{(JKBXVO) jkbxvo});
		} else {
			if (!StringUtils.isEmpty(accessorybillid)) {
				((JKBXVO) jkbxvo).getParentVO().setPk_jkbx(accessorybillid);
			} else if (!StringUtils.isEmpty(msg_pk_bill)
					&& StringUtils.isEmpty(((JKBXVO) jkbxvo).getParentVO().getPk_jkbx())) {
				((JKBXVO) jkbxvo).getParentVO().setPk_jkbx(msg_pk_bill);
			}

			rtnVOArr = this.getIBXBillPublic().save(new JKBXVO[]{(JKBXVO) jkbxvo});
		}

		UFBoolean isUseImage = SysInitQueryForNcc.getParaBoolean(InvocationInfoProxy.getInstance().getGroupId(),
				"ER28");
		if (rtnVOArr != null && rtnVOArr.length > 0 && isUseImage != null && isUseImage.booleanValue()
				&& "true".equals(imageUploadCheck)) {
			NCCImageUtil.ybzImageBind(rtnVOArr[0]);
		}

		String pk_jkbx = ((JKBXVO) jkbxvo).getParentVO().getPk_jkbx();
		((IWebPubService) NCLocator.getInstance().lookup(IWebPubService.class)).deleteSysFile(pk_jkbx, "1");
		JKBXVO returnVO = rtnVOArr[0];
		ERMBillVOUtil.dealVODigit(returnVO);
		new BXBillVO();
		BXBillVO revo = BXBillVO.getBXBillVO(returnVO);
		return revo;
	}

	public JKBillVO tempSaveJKBX(JKBillVO bill, RequestParam request) throws Exception {
		JKBXVO[] rtnVOArr = null;
		JKBXVO cvo = bill.toJKVO();
		JKBXVO jkbxvo = new JKVO();
		String pk_tradetype = cvo.getParentVO().getDjlxbm();
		String status = (String) request.getParameter("uistate") == null
				? (String) request.getParameter("status")
				: (String) request.getParameter("uistate");
		String ntbCheck = (String) request.getParameter("ntbCheck");
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		String jkCheck = (String) request.getParameter("jkCheck");
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		Boolean isinit = false;
		if (request.getParameter("isinit") instanceof Boolean) {
			isinit = (Boolean) request.getParameter("isinit");
		} else if (String.valueOf(request.getParameter("isinit")).equals("true")) {
			isinit = true;
		}

		cvo.getParentVO().setDjzt(0);
		if (pk_tradetype.startsWith("264")) {
			jkbxvo = cvo;
		} else if (pk_tradetype.startsWith("263")) {
			jkbxvo = cvo;
		}

		if (bill.getParentVO().getAttributeValue("imag_status") != null) {
			bill.getParentVO().setAttributeValue("imag_status", (Object) null);
		}

		JKBXVO oldJkbxBill = jkbxvo.getBxoldvo();
		List<JKBXVO> oldvo = null;
		BXBusItemVO[] oldItems = null;
		oldvo = ((IBXBillPrivate) NCLocator.getInstance().lookup(IBXBillPrivate.class)).queryVOsByPrimaryKeysForNewNode(
				new String[]{jkbxvo.getParentVO().getPrimaryKey()}, jkbxvo.getParentVO().getDjdl(),
				jkbxvo.getParentVO().isInit(), (ERMDjCondVO) null);
		if (oldvo != null) {
			oldJkbxBill = (JKBXVO) oldvo.get(0);
			oldItems = oldJkbxBill.getChildrenVO();
		} else {
			oldItems = new BXBusItemVO[0];
		}

		this.setBillSrcSystem(jkbxvo);
		this.setBillStatus(jkbxvo, status);
		if ("true".equals(ntbCheck)) {
			jkbxvo.setHasNtbCheck(Boolean.TRUE);
		}

		if ("true".equals(proBudgetCheck)) {
			jkbxvo.setHasProBudgetCheck(Boolean.TRUE);
		}

		if ("true".equals(jkCheck)) {
			jkbxvo.setHasJkCheck(Boolean.TRUE);
		}

		if (isinit != null && isinit) {
			jkbxvo.getParentVO().setQcbz(UFBoolean.TRUE);
		}

		if (!"264a".equals(pk_tradetype)) {
			this.calculateShareRatio(jkbxvo);
		}

		if ("edit".equals(status)) {
			if ("2647".equals(pk_tradetype)) {
				jkbxvo.setChildrenVO(oldItems);
			}

			jkbxvo.setContrastUpdate(true);
			rtnVOArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{jkbxvo});
		} else {
			if (!StringUtils.isEmpty(accessorybillid)) {
				jkbxvo.getParentVO().setPk_jkbx(accessorybillid);
			} else if (!StringUtils.isEmpty(msg_pk_bill) && StringUtils.isEmpty(jkbxvo.getParentVO().getPk_jkbx())) {
				jkbxvo.getParentVO().setPk_jkbx(msg_pk_bill);
			}

			rtnVOArr = this.getIBXBillPublic().tempSave(new JKBXVO[]{jkbxvo});
		}

		String pk_jkbx = jkbxvo.getParentVO().getPk_jkbx();
		((IWebPubService) NCLocator.getInstance().lookup(IWebPubService.class)).deleteSysFile(pk_jkbx, "1");
		JKBXVO returnVO = rtnVOArr[0];
		ERMBillVOUtil.dealVODigit(returnVO);
		new JKBillVO();
		JKBillVO revo = JKBillVO.getJKBillVO(returnVO);
		return revo;
	}

	public JKBillVO saveJKBX(JKBillVO bill, RequestParam request) throws Exception {
		JKBXVO[] rtnVOArr = null;
		JKBXVO cvo = bill.toJKVO();
		JKBXVO jkbxvo = new JKVO();
		String pk_tradetype = cvo.getParentVO().getDjlxbm();
		String status = (String) request.getParameter("uistate") == null
				? (String) request.getParameter("status")
				: (String) request.getParameter("uistate");
		String ntbCheck = (String) request.getParameter("ntbCheck");
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		String jkCheck = (String) request.getParameter("jkCheck");
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		String templateId = request.getParameter("templateid") == null
				? null
				: request.getParameter("templateid").toString();
		Boolean isinit = false;
		if (request.getParameter("isinit") instanceof Boolean) {
			isinit = (Boolean) request.getParameter("isinit");
		} else if (String.valueOf(request.getParameter("isinit")).equals("true")) {
			isinit = true;
		}

		if (pk_tradetype.startsWith("264")) {
			jkbxvo = cvo;
		} else if (pk_tradetype.startsWith("263")) {
			jkbxvo = cvo;
		}

		if (((JKBXVO) jkbxvo).getParentVO().getDjzt() != null && ((JKBXVO) jkbxvo).getParentVO().getDjzt() == 0) {
			((JKBXVO) jkbxvo).getParentVO().setDjzt(1);
		}

		if (bill.getParentVO().getAttributeValue("imag_status") != null) {
			bill.getParentVO().setAttributeValue("imag_status", (Object) null);
		}

		ERMReimResultVO[] RemresultVOS = this.loadReim((JKBXVO) jkbxvo, (String) request.getParameter("pagecode"),
				(String) request.getParameter("appcode"), -1, (Map) null, templateId);
		if (RemresultVOS != null && RemresultVOS.length > 0) {
			String reimmsg = RemresultVOS[0].getMsg();
			request.setParameter("reimmsg", reimmsg);
		}

		JKBXVO oldJkbxBill = ((JKBXVO) jkbxvo).getBxoldvo();
		List<JKBXVO> oldvo = null;
		BXBusItemVO[] oldItems = null;
		oldvo = ((IBXBillPrivate) NCLocator.getInstance().lookup(IBXBillPrivate.class)).queryVOsByPrimaryKeysForNewNode(
				new String[]{((JKBXVO) jkbxvo).getParentVO().getPrimaryKey()},
				((JKBXVO) jkbxvo).getParentVO().getDjdl(), ((JKBXVO) jkbxvo).getParentVO().isInit(),
				(ERMDjCondVO) null);
		if (oldvo != null) {
			oldJkbxBill = (JKBXVO) oldvo.get(0);
			oldItems = oldJkbxBill.getChildrenVO();
		} else {
			oldItems = new BXBusItemVO[0];
		}

		this.filterBusitemVO((JKBXVO) jkbxvo);
		if (!((JKBXVO) jkbxvo).getParentVO().isAdjustBxd()) {
			jkbxvo = this.completMtappInfo((JKBXVO) jkbxvo);
		}

		this.setBillSrcSystem((JKBXVO) jkbxvo);
		this.setBillStatus((JKBXVO) jkbxvo, status);
		if ("true".equals(ntbCheck)) {
			((JKBXVO) jkbxvo).setHasNtbCheck(Boolean.TRUE);
		}

		if ("true".equals(proBudgetCheck)) {
			((JKBXVO) jkbxvo).setHasProBudgetCheck(Boolean.TRUE);
		}

		if ("true".equals(jkCheck)) {
			((JKBXVO) jkbxvo).setHasJkCheck(Boolean.TRUE);
		}

		if (isinit != null && isinit) {
			((JKBXVO) jkbxvo).getParentVO().setQcbz(UFBoolean.TRUE);
		}

		if (!"264a".equals(pk_tradetype)) {
			this.calculateShareRatio((JKBXVO) jkbxvo);
		}

		if ("edit".equals(status)) {
			if ("2647".equals(pk_tradetype)) {
				((JKBXVO) jkbxvo).setChildrenVO(oldItems);
			}

			((JKBXVO) jkbxvo).setContrastUpdate(true);
			rtnVOArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{(JKBXVO) jkbxvo});
		} else {
			if (!StringUtils.isEmpty(accessorybillid)) {
				((JKBXVO) jkbxvo).getParentVO().setPk_jkbx(accessorybillid);
			} else if (!StringUtils.isEmpty(msg_pk_bill)
					&& StringUtils.isEmpty(((JKBXVO) jkbxvo).getParentVO().getPk_jkbx())) {
				((JKBXVO) jkbxvo).getParentVO().setPk_jkbx(msg_pk_bill);
			}

			rtnVOArr = this.getIBXBillPublic().save(new JKBXVO[]{(JKBXVO) jkbxvo});
		}

		String pk_jkbx = ((JKBXVO) jkbxvo).getParentVO().getPk_jkbx();
		((IWebPubService) NCLocator.getInstance().lookup(IWebPubService.class)).deleteSysFile(pk_jkbx, "1");
		JKBXVO returnVO = rtnVOArr[0];
		ERMBillVOUtil.dealVODigit(returnVO);
		new JKBillVO();
		JKBillVO revo = JKBillVO.getJKBillVO(returnVO);
		return revo;
	}

	public String deleteJKBX(RequestParam request) throws Exception {
		String openBillId = (String) request.getParameter("openbillid");
		JSONObject json = new JSONObject();
		if (null != openBillId) {
			String[] pks = new String[]{openBillId};
			List<JKBXVO> bxVOList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, (String) null);
			if (bxVOList == null || bxVOList.size() <= 0) {
				throw new Exception(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
						"02011005_expenseaccount-0021"));
			}

			((IWebPubService) NCLocator.getInstance().lookup(IWebPubService.class))
					.interceptorVaildator((AggregatedValueObject) bxVOList.get(0), "delete");
			Iterator var6 = bxVOList.iterator();

			while (var6.hasNext()) {
				JKBXVO jkbxvo = (JKBXVO) var6.next();
				UFBoolean qcbz = jkbxvo.getParentVO().getQcbz();
				BxcontrastVO[] contrastVos = jkbxvo.getContrastVO();
				if (qcbz != null && qcbz.booleanValue() && contrastVos != null && contrastVos.length > 0) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0",
							"0expenseaccount2011-0063") + contrastVos[0].getBxdjbh());
				}
			}

			if (ERMValueCheck.isNotEmpty(bxVOList)) {
				List<String> jkbxVOList = new ArrayList();
				Iterator var13 = bxVOList.iterator();

				while (var13.hasNext()) {
					JKBXVO eachVO = (JKBXVO) var13.next();
					jkbxVOList.add(eachVO.getParentVO().getPrimaryKey());
				}

				((IImagPubService) NCLocator.getInstance().lookup(IImagPubService.class)).deleteImageAndInvoice(
						(String[]) jkbxVOList.toArray(new String[0]), InvocationInfoProxy.getInstance().getUserId(),
						NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0",
								"0expenseaccount2011-0064"));
				this.getIBXBillPublic().deleteBills((JKBXVO[]) bxVOList.toArray(new JKBXVO[bxVOList.size()]));
				NCFileVO[] ncFileVOs = this.queryFileVOsByPath(openBillId, true);
				if (ncFileVOs != null && ncFileVOs.length > 0) {
					NCFileVO[] var16 = ncFileVOs;
					int var17 = ncFileVOs.length;

					for (int var10 = 0; var10 < var17; ++var10) {
						NCFileVO var10000 = var16[var10];
					}
				}

				json.put("success", "true");
			}
		}

		return json.toString();
	}

	public JKBXVO viewJKBX(RequestParam request) throws Exception {
		String openbillid = (String) request.getParameter("openbillid");
		String pk_tradetype = String
				.valueOf(request.getParameter("tradetype") == null ? "" : request.getParameter("tradetype"));
		String uid = InvocationInfoProxy.getInstance().getUserId();
		if (StringUtils.isNoneBlank(new CharSequence[]{openbillid, uid})
				&& uid.equals(InvocationInfoProxy.getInstance().getUserId())) {
			String[] pks = new String[]{openbillid};

			try {
				JKBXVO jkbxvo = null;
				List<JKBXVO> jkbxvoList = null;
				if (pk_tradetype.startsWith("264")) {
					jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "bx");
					if (ERMValueCheck.isEmpty(jkbxvoList)) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes()
								.getStrByID("2011005_expenseaccount_0", "02011005_expenseaccount-0022"));
					}

					jkbxvo = (JKBXVO) jkbxvoList.get(0);
					ERMBillVOUtil.dealVODigit(jkbxvo);
					ERMBillVOUtil.dealImageState(jkbxvo);
				} else if (pk_tradetype.startsWith("263")) {
					jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "jk");
					if (ERMValueCheck.isEmpty(jkbxvoList)) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes()
								.getStrByID("2011005_expenseaccount_0", "02011005_expenseaccount-0022"));
					}

					jkbxvo = (JKBXVO) jkbxvoList.get(0);
					ERMBillVOUtil.dealVODigit(jkbxvo);
				} else {
					jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, (String) null);
					if (ERMValueCheck.isEmpty(jkbxvoList)) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes()
								.getStrByID("2011005_expenseaccount_0", "02011005_expenseaccount-0022"));
					}

					jkbxvo = (JKBXVO) jkbxvoList.get(0);
					ERMBillVOUtil.dealVODigit(jkbxvo);
				}

				if (jkbxvo != null && jkbxvo.getParentVO() != null) {
					if (!StringUtils.isEmpty(jkbxvo.getParentVO().getPk_org())) {
						String sp0102 = SysinitAccessor.getInstance().getParaString(jkbxvo.getParentVO().getPk_org(),
								"SP001");
						jkbxvo.getParentVO().setSp0102(sp0102);
					} else {
						jkbxvo.getParentVO().setSp0102("N");
					}
				}

				return jkbxvo;
			} catch (BusinessException var9) {
				Logger.error(var9.getMessage(), var9);
				throw new RuntimeException(var9.getMessage(), var9);
			} catch (Exception var10) {
				Logger.error(var10.getMessage(), var10);
				throw new RuntimeException(var10.getMessage(), var10);
			}
		} else {
			return null;
		}
	}

	public NCFileVO[] queryFileVOsByPath(String path, Boolean isAll) throws Exception {
		path = FileSystemUtil.validatePathString(path);
		String sql = "select pk, filepath, creator,isfolder,lasttime,filelength,isdoc,pk_doc,modifier,filedesc,scantimes,modifytime,filetype from sm_pub_filesystem where filepath=? or filepath like ?";
		if (!isAll) {
			sql = sql + " and dr = 0";
		}

		SQLParameter param = new SQLParameter();
		param.addParam(path);
		param.addParam(path + "/%");
		BaseDAO dao = new BaseDAO();
		List<NCFileVO> list = (List) dao.executeQuery(sql, param, new NCFileVOResultSetProcessor());
		return (NCFileVO[]) list.toArray(new NCFileVO[0]);
	}

	private void SetVerifyVOToBXVO(JKBXVO jkbxvo, String str) {
		List<AccruedVerifyVO> list = new ArrayList();
		if (jkbxvo != null && jkbxvo.getAccruedVerifyVO() != null) {
			AccruedVerifyVO[] var4 = jkbxvo.getAccruedVerifyVO();
			int var5 = var4.length;

			for (int var6 = 0; var6 < var5; ++var6) {
				AccruedVerifyVO vo = var4[var6];
				list.add(vo);
			}
		}

		jkbxvo.setAccruedVerifyVO((AccruedVerifyVO[]) list.toArray(new AccruedVerifyVO[list.size()]));
	}

	private void filterBusitemVO(JKBXVO bxVO) {
		if (!"2647".equals(bxVO.getParentVO().getDjlxbm())) {
			List<BXBusItemVO> filteredBusiList = new ArrayList();
			if (ERMValueCheck.isNotEmpty(bxVO.getBxBusItemVOS())) {
				BXBusItemVO[] var3 = bxVO.getBxBusItemVOS();
				int var4 = var3.length;

				for (int var5 = 0; var5 < var4; ++var5) {
					BXBusItemVO eachVO = var3[var5];
					if (eachVO.getAmount() != null && eachVO.getAmount().compareTo(UFDouble.ZERO_DBL) != 0) {
						filteredBusiList.add(eachVO);
					}
				}
			}

			bxVO.setBxBusItemVOS((BXBusItemVO[]) filteredBusiList.toArray(new BXBusItemVO[filteredBusiList.size()]));
			if (ERMValueCheck.isNotEmpty(bxVO.getcShareDetailVo())) {
				List<CShareDetailVO> filteredShareList = new ArrayList();
				boolean adjustBxd = bxVO.getParentVO().isAdjustBxd();
				CShareDetailVO[] var11 = bxVO.getcShareDetailVo();
				int var12 = var11.length;

				for (int var7 = 0; var7 < var12; ++var7) {
					CShareDetailVO eachVO = var11[var7];
					if (adjustBxd || eachVO.getAssume_amount() != null
							&& eachVO.getAssume_amount().compareTo(UFDouble.ZERO_DBL) != 0) {
						filteredShareList.add(eachVO);
					}
				}

				bxVO.setcShareDetailVo(
						(CShareDetailVO[]) filteredShareList.toArray(new CShareDetailVO[filteredShareList.size()]));
			}

		}
	}

	private void calculateShareRatio(JKBXVO bxVO) {
		if (ERMValueCheck.isNotEmpty(bxVO.getcShareDetailVo()) && ERMValueCheck.isNotEmpty(bxVO.getBxBusItemVOS())) {
			Map<String, UFDouble> bzAmountMap = new HashMap();
			BXBusItemVO[] var3 = bxVO.getBxBusItemVOS();
			int var4 = var3.length;

			int var5;
			for (var5 = 0; var5 < var4; ++var5) {
				BXBusItemVO busitemVO = var3[var5];
				if (bzAmountMap.containsKey(busitemVO.getBzbm())) {
					bzAmountMap.put(busitemVO.getBzbm(),
							((UFDouble) bzAmountMap.get(busitemVO.getBzbm())).add(busitemVO.getAmount()));
				} else {
					bzAmountMap.put(busitemVO.getBzbm(), busitemVO.getAmount());
				}
			}

			CShareDetailVO[] var7 = bxVO.getcShareDetailVo();
			var4 = var7.length;

			for (var5 = 0; var5 < var4; ++var5) {
				CShareDetailVO shareVO = var7[var5];
				if (ERMValueCheck.isNotEmpty(shareVO.getAssume_amount())
						&& !UFDouble.ZERO_DBL.equals(shareVO.getAssume_amount())
						&& bzAmountMap.containsKey(shareVO.getBzbm())) {
					shareVO.setShare_ratio(shareVO.getAssume_amount().div((UFDouble) bzAmountMap.get(shareVO.getBzbm()))
							.multiply(100.0D).setScale(8, 4));
				}
			}
		}

	}

	private void setBillStatus(JKBXVO jkbxAggVO, String status) {
		BXBusItemVO[] var3;
		int var4;
		int var5;
		BXBusItemVO detailVO;
		BxcontrastVO[] var7;
		CShareDetailVO[] var8;
		AccruedVerifyVO[] var9;
		BxcontrastVO contrastVO;
		CShareDetailVO shareVO;
		AccruedVerifyVO verifyVO;
		if ("edit".equals(status)) {
			jkbxAggVO.getParentVO().setStatus(1);
			if (null != jkbxAggVO.getChildrenVO()) {
				var3 = jkbxAggVO.getChildrenVO();
				var4 = var3.length;

				for (var5 = 0; var5 < var4; ++var5) {
					detailVO = var3[var5];
					if (3 != detailVO.getStatus()) {
						if (detailVO.getPrimaryKey() != null && detailVO.getPrimaryKey().length() != 0) {
							detailVO.setStatus(1);
						} else {
							detailVO.setStatus(2);
						}
					}
				}
			}

			if (null != jkbxAggVO.getContrastVO()) {
				var7 = jkbxAggVO.getContrastVO();
				var4 = var7.length;

				for (var5 = 0; var5 < var4; ++var5) {
					contrastVO = var7[var5];
					if (3 != contrastVO.getStatus()) {
						if (contrastVO.getPrimaryKey() != null && contrastVO.getPrimaryKey().length() != 0) {
							contrastVO.setStatus(1);
						} else {
							contrastVO.setStatus(2);
						}
					}
				}
			}

			if (null != jkbxAggVO.getcShareDetailVo()) {
				var8 = jkbxAggVO.getcShareDetailVo();
				var4 = var8.length;

				for (var5 = 0; var5 < var4; ++var5) {
					shareVO = var8[var5];
					if (3 != shareVO.getStatus()) {
						if (shareVO.getPrimaryKey() != null && shareVO.getPrimaryKey().length() != 0) {
							shareVO.setStatus(1);
						} else {
							shareVO.setStatus(2);
						}
					}
				}
			}

			if (null != jkbxAggVO.getAccruedVerifyVO()) {
				var9 = jkbxAggVO.getAccruedVerifyVO();
				var4 = var9.length;

				for (var5 = 0; var5 < var4; ++var5) {
					verifyVO = var9[var5];
					if (3 != verifyVO.getStatus()) {
						if (verifyVO.getPrimaryKey() != null && verifyVO.getPrimaryKey().length() != 0) {
							verifyVO.setStatus(1);
						} else {
							verifyVO.setStatus(2);
						}
					}
				}
			}
		} else {
			jkbxAggVO.getParentVO().setStatus(2);
			if (null != jkbxAggVO.getChildrenVO()) {
				var3 = jkbxAggVO.getChildrenVO();
				var4 = var3.length;

				for (var5 = 0; var5 < var4; ++var5) {
					detailVO = var3[var5];
					if (3 != detailVO.getStatus()) {
						detailVO.setStatus(2);
					}
				}
			}

			if (null != jkbxAggVO.getContrastVO()) {
				var7 = jkbxAggVO.getContrastVO();
				var4 = var7.length;

				for (var5 = 0; var5 < var4; ++var5) {
					contrastVO = var7[var5];
					if (3 != contrastVO.getStatus()) {
						contrastVO.setStatus(2);
					}
				}
			}

			if (null != jkbxAggVO.getcShareDetailVo()) {
				var8 = jkbxAggVO.getcShareDetailVo();
				var4 = var8.length;

				for (var5 = 0; var5 < var4; ++var5) {
					shareVO = var8[var5];
					if (3 != shareVO.getStatus()) {
						shareVO.setStatus(2);
					}
				}
			}

			if (null != jkbxAggVO.getAccruedVerifyVO()) {
				var9 = jkbxAggVO.getAccruedVerifyVO();
				var4 = var9.length;

				for (var5 = 0; var5 < var4; ++var5) {
					verifyVO = var9[var5];
					if (3 != verifyVO.getStatus()) {
						verifyVO.setStatus(2);
					}
				}
			}
		}

	}

	private void setBillSrcSystem(JKBXVO jkbxAggVO) {
		jkbxAggVO.getParentVO().setSrcsystem("iweb");
	}

	private IBXBillPublic getIBXBillPublic() {
		return (IBXBillPublic) NCLocator.getInstance().lookup(IBXBillPublic.class);
	}

	protected IBXBillPrivate getIBXBillPrivate() throws ComponentException {
		return (IBXBillPrivate) NCLocator.getInstance().lookup(IBXBillPrivate.class.getName());
	}

	public void loadReim() throws Exception {
	}

	public JKBXVO saveJKBX(JKBXVO bill, RequestParam request) throws Exception {
		JKBXVO[] rtnVOArr = null;
		AbstractBill jkbxBillVO = null;
		JKBXVO jkbxvo = new BXVO();
		String pk_tradetype = bill.getParentVO().getDjlxbm();
		String status = (String) request.getParameter("state");
		String ntbCheck = (String) request.getParameter("ntbCheck");
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		String jkCheck = (String) request.getParameter("jkCheck");
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		if (pk_tradetype.startsWith("264")) {
			jkbxvo = bill;
		} else if (pk_tradetype.startsWith("263")) {
			jkbxvo = bill;
		}

		if (((JKBXVO) jkbxvo).getParentVO().getDjzt() != null && ((JKBXVO) jkbxvo).getParentVO().getDjzt() == 0) {
			((JKBXVO) jkbxvo).getParentVO().setDjzt(1);
		}

		JKBXVO oldJkbxBill = ((JKBXVO) jkbxvo).getBxoldvo();
		List<JKBXVO> oldvo = null;
		BXBusItemVO[] oldItems = null;
		oldvo = ((IBXBillPrivate) NCLocator.getInstance().lookup(IBXBillPrivate.class)).queryVOsByPrimaryKeysForNewNode(
				new String[]{((JKBXVO) jkbxvo).getParentVO().getPrimaryKey()},
				((JKBXVO) jkbxvo).getParentVO().getDjdl(), ((JKBXVO) jkbxvo).getParentVO().isInit(),
				(ERMDjCondVO) null);
		if (oldvo != null) {
			oldJkbxBill = (JKBXVO) oldvo.get(0);
			oldItems = oldJkbxBill.getChildrenVO();
		} else {
			oldItems = new BXBusItemVO[0];
		}

		this.filterBusitemVO((JKBXVO) jkbxvo);
		this.setBillSrcSystem((JKBXVO) jkbxvo);
		this.setBillStatus((JKBXVO) jkbxvo, status);
		if ("true".equals(ntbCheck)) {
			((JKBXVO) jkbxvo).setHasNtbCheck(Boolean.TRUE);
		}

		if ("true".equals(proBudgetCheck)) {
			((JKBXVO) jkbxvo).setHasProBudgetCheck(Boolean.TRUE);
		}

		if ("true".equals(jkCheck)) {
			((JKBXVO) jkbxvo).setHasJkCheck(Boolean.TRUE);
		}

		if (!"264a".equals(pk_tradetype)) {
			this.calculateShareRatio((JKBXVO) jkbxvo);
		}

		if ("edit".equals(status)) {
			((JKBXVO) jkbxvo).setContrastUpdate(true);
			rtnVOArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{(JKBXVO) jkbxvo});
		} else {
			if (!StringUtils.isEmpty(accessorybillid)) {
				((JKBXVO) jkbxvo).getParentVO().setPk_jkbx(accessorybillid);
			} else if (!StringUtils.isEmpty(msg_pk_bill)
					&& StringUtils.isEmpty(((JKBXVO) jkbxvo).getParentVO().getPk_jkbx())) {
				((JKBXVO) jkbxvo).getParentVO().setPk_jkbx(msg_pk_bill);
			}

			rtnVOArr = this.getIBXBillPublic().save(new JKBXVO[]{(JKBXVO) jkbxvo});
		}

		String pk_jkbx = ((JKBXVO) jkbxvo).getParentVO().getPk_jkbx();
		((IWebPubService) NCLocator.getInstance().lookup(IWebPubService.class)).deleteSysFile(pk_jkbx, "1");
		JKBXVO returnVO = rtnVOArr[0];
		ERMBillVOUtil.dealVODigit(returnVO);
		return returnVO;
	}

	public AggregatedValueObject dealDefValue(RequestParam request, String pk_group, String pk_org, String pk_user,
			String type) throws Exception {
		String pk_tradetype = (String) request.getParameter("tradetype");
		pk_tradetype = NCESAPI.sqlEncode(pk_tradetype);
		String nodecode = (String) request.getParameter("nodecode");
		AbstractBillDefValue billDefValue = new JKBXBillDefValue(pk_group, pk_org, pk_user, pk_tradetype, nodecode);
		AggregatedValueObject billvo = null;
		if ("onInit".equals(type)) {
			billvo = billDefValue.getNewVO();
		} else if ("onChange".equals(type)) {
			billvo = billDefValue.getDefaultVO(pk_org);
		}

		return billvo;
	}

	public JKBXVO copyJKBX(RequestParam request) throws Exception {
		String openbillid = request.getParameter("copyFromBillId").toString();
		String pk_tradetype = request.getParameter("tradetype").toString();
		if (StringUtils.isNotEmpty(openbillid)) {
			List<JKBXVO> jkbxvoList = null;
			String[] pks = new String[]{openbillid};
			JKBXVO copyVO;
			if (pk_tradetype.startsWith("264a")) {
				jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "bx");
				if (ERMValueCheck.isEmpty(jkbxvoList)) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0022"));
				}

				copyVO = (JKBXVO) ((JKBXVO) jkbxvoList.get(0)).clone();
				ERMBillVOUtil.doCopy4Adjust(copyVO);
				copyVO.setAccruedVerifyVO((AccruedVerifyVO[]) null);
				ERMBillVOUtil.dealVODigit(copyVO);
				return copyVO;
			}

			if (pk_tradetype.startsWith("264")) {
				jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "bx");
				if (ERMValueCheck.isEmpty(jkbxvoList)) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0022"));
				}

				copyVO = (JKBXVO) ((JKBXVO) jkbxvoList.get(0)).clone();
				ERMBillVOUtil.doCopy(copyVO);
				copyVO.setAccruedVerifyVO((AccruedVerifyVO[]) null);
				ERMBillVOUtil.dealVODigit(copyVO);
				return copyVO;
			}

			if (pk_tradetype.startsWith("263")) {
				jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "jk");
				if (ERMValueCheck.isEmpty(jkbxvoList)) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0022"));
				}

				copyVO = (JKBXVO) ((JKBXVO) jkbxvoList.get(0)).clone();
				ERMBillVOUtil.doCopy(copyVO);
				ERMBillVOUtil.dealVODigit(copyVO);
				return copyVO;
			}
		}

		return null;
	}

	public JKBXVO invalidJKBX(RequestParam request) throws Exception {
		String openbillid = request.getParameter("openbillid").toString();
		String pk_tradetype = request.getParameter("tradetype").toString();
		if (StringUtils.isNotEmpty(openbillid)) {
			List<JKBXVO> jkbxvoList = null;
			String[] pks = new String[]{openbillid};
			JKBXVO invalidVO;
			String paramValue;
			Boolean isSuccessDeleteByswy;
			if (pk_tradetype.startsWith("264a")) {
				jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "bx");
				if (ERMValueCheck.isEmpty(jkbxvoList)) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0022"));
				}

				invalidVO = this.getIBXBillPublic().invalidBill((JKBXVO) jkbxvoList.get(0));
				paramValue = SysInitQuery.getParaString("GLOBLE00000000000000", "IV0001");
				if ("2".equals(paramValue)) {
					isSuccessDeleteByswy = ((IIVMInvoiceInterfaceService) NCLocator.getInstance()
							.lookup(IIVMInvoiceInterfaceService.class)).deleteInvoice(pks,
									((JKBXVO) jkbxvoList.get(0)).getParentVO().getPk_org());
					if (null != isSuccessDeleteByswy && !isSuccessDeleteByswy) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0",
								"0expenseaccount2011-0065"));
					}
				}

				return invalidVO;
			}

			if (pk_tradetype.startsWith("264")) {
				jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "bx");
				if (ERMValueCheck.isEmpty(jkbxvoList)) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0022"));
				}

				invalidVO = this.getIBXBillPublic().invalidBill((JKBXVO) jkbxvoList.get(0));
				paramValue = SysInitQuery.getParaString("GLOBLE00000000000000", "IV0001");
				if ("2".equals(paramValue)) {
					isSuccessDeleteByswy = ((IIVMInvoiceInterfaceService) NCLocator.getInstance()
							.lookup(IIVMInvoiceInterfaceService.class)).deleteInvoice(pks,
									((JKBXVO) jkbxvoList.get(0)).getParentVO().getPk_org());
					if (null != isSuccessDeleteByswy && !isSuccessDeleteByswy) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0",
								"0expenseaccount2011-0065"));
					}
				}

				return invalidVO;
			}

			if (pk_tradetype.startsWith("263")) {
				jkbxvoList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, "jk");
				if (ERMValueCheck.isEmpty(jkbxvoList)) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0022"));
				}

				invalidVO = this.getIBXBillPublic().invalidBill((JKBXVO) jkbxvoList.get(0));
				return invalidVO;
			}
		}

		return null;
	}

	public Object submitJKBX(JKBXVO bill, RequestParam request) throws Exception {
		String status = (String) request.getParameter("status");
		String pk_tradetype = request.getParameter("pk_tradetype").toString();
		String openBillId = (String) request.getParameter("openbillid");
		String ntbCheck = request.getParameter("ntbCheck").toString();
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		String jkCheck = request.getParameter("jkCheck").toString();
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		String imageUploadCheck = (String) request.getParameter("imageUploadCheck");
		String templateId = request.getParameter("templateid") == null
				? null
				: request.getParameter("templateid").toString();
		if (!bill.getParentVO().isAdjustBxd()) {
			this.checkRelatedMtappbill(bill);
			bill = this.completMtappInfo(bill);
		}

		JKBXVO jkbxvo = null;
		JKBXVO[] saveResultArr = null;
		String mobile;
		if (!StringUtil.isEmptyWithTrim(openBillId) && "browse".equals(status)) {
			String[] pks = new String[]{openBillId};
			List<JKBXVO> bxVOList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, (String) null);
			if (ERMValueCheck.isNotEmpty(bxVOList)) {
				jkbxvo = (JKBXVO) bxVOList.get(0);
				if (jkbxvo != null) {
					if (-1 == jkbxvo.getParentVO().getDjzt()) {
						throw new Exception(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
								"02011005_expenseaccount-0023"));
					}

					if (null == bill.getParentVO().getTs()
							|| bill.getParentVO().getTs().compareTo(jkbxvo.getParentVO().getTs()) != 0) {
						throw new Exception(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
								"02011005_expenseaccount-0024"));
					}

					this.filterBusitemVO(jkbxvo);
					this.setBillSrcSystem(jkbxvo);
					if ("true".equals(ntbCheck)) {
						jkbxvo.setHasNtbCheck(Boolean.TRUE);
					}

					if ("true".equals(proBudgetCheck)) {
						jkbxvo.setHasProBudgetCheck(Boolean.TRUE);
					}

					if ("true".equals(jkCheck)) {
						jkbxvo.setHasJkCheck(Boolean.TRUE);
					}

					jkbxvo.setHasCrossCheck(Boolean.TRUE);
					saveResultArr = new JKBXVO[]{jkbxvo};
				}
			}
		} else {
			doBankStatusCheck(bill);
			this.filterBusitemVO(bill);
			bill.getParentVO().setDjzt(1);
			this.setBillSrcSystem(bill);
			this.setBillStatus(bill, status);
			ERMReimResultVO[] RemresultVOS = this.loadReim(bill, (String) request.getParameter("pagecode"),
					(String) request.getParameter("appcode"), -1, (Map) null, templateId);
			if (RemresultVOS != null && RemresultVOS.length > 0) {
				mobile = RemresultVOS[0].getMsg();
				request.setParameter("reimmsg", mobile);
			}

			if ("true".equals(ntbCheck)) {
				bill.setHasNtbCheck(Boolean.TRUE);
			}

			if ("true".equals(proBudgetCheck)) {
				bill.setHasProBudgetCheck(Boolean.TRUE);
			}

			if ("true".equals(jkCheck)) {
				bill.setHasJkCheck(Boolean.TRUE);
			}

			if (!"264a".equals(pk_tradetype)) {
				this.calculateShareRatio(bill);
			}

			InvocationInfoProxy.getInstance().setProperty("ErmDirectSubmit", "Y");
			if ("edit".equals(status)) {
				bill.setContrastUpdate(true);
				bill.setHasCrossCheck(Boolean.TRUE);
				saveResultArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{bill});
			} else {
				if (!StringUtils.isEmpty(openBillId)) {
					bill.getParentVO().setPk_jkbx(openBillId);
				} else if (!StringUtils.isEmpty(accessorybillid)) {
					bill.getParentVO().setPk_jkbx(accessorybillid);
				}

				saveResultArr = this.getIBXBillPublic().save(new JKBXVO[]{bill});
			}

			UFBoolean isUseImage = SysInitQueryForNcc.getParaBoolean(InvocationInfoProxy.getInstance().getGroupId(),
					"ER28");
			if (saveResultArr != null && saveResultArr.length > 0 && isUseImage != null && isUseImage.booleanValue()
					&& "true".equals(imageUploadCheck)) {
				NCCImageUtil.ybzImageBind(saveResultArr[0]);
			}
		}

		if (saveResultArr != null && saveResultArr.length > 0) {
			JKBXVO returnVO = saveResultArr[0];
			ERMBillVOUtil.dealVODigit((JKBXVO) returnVO);
			mobile = InvocationInfoProxy.getInstance().getProperty("clientType");
			Object obj = null;
			if ("mobile".equals(mobile)) {
				obj = ERMPfUtil.doYbzCommit(saveResultArr, pk_tradetype, request);
			} else {
				obj = ERMPfUtil.doNccCommit(saveResultArr, pk_tradetype, request);
			}

			if (obj instanceof Map) {
				((Map) obj).put("billid", saveResultArr[0].getParentVO().getPk_jkbx());
				((Map) obj).put("billvo", returnVO);
				return obj;
			} else {
				return returnVO;
			}
		} else {
			return null;
		}
	}

	public void checkRelatedMtappbill(JKBXVO bill) throws ComponentException, BusinessException {
		Set<String> pk_itemSet = new HashSet();
		if (bill.getChildrenVO() != null && bill.getChildrenVO().length > 0) {
			BXBusItemVO[] var3 = bill.getChildrenVO();
			int var4 = var3.length;
			int var5 = 0;

			while (true) {
				if (var5 >= var4) {
					if (pk_itemSet != null && pk_itemSet.size() > 0) {
						AggMatterAppVO[] aggMatterAppVOs = ((IErmMatterAppBillQuery) NCLocator.getInstance()
								.lookup(IErmMatterAppBillQuery.class.getName()))
										.queryBillByPKs((String[]) pk_itemSet.toArray(new String[0]));
						if (aggMatterAppVOs == null || aggMatterAppVOs.length <= 0) {
							throw new BusinessException(
									NCLangRes4VoTransl.getNCLangRes().getStrByID("201107_0", "0201107-0106"));
						}

						AggMatterAppVO[] var15 = aggMatterAppVOs;
						var5 = aggMatterAppVOs.length;

						for (int var16 = 0; var16 < var5; ++var16) {
							AggMatterAppVO mtappVo = var15[var16];
							if (mtappVo.getParentVO().getEffectstatus() != 1) {
								throw new BusinessException(
										NCLangRes4VoTransl.getNCLangRes().getStrByID("201212_0", "0201212-0108"));
							}

							String condition = MatterAppVO.getDefaultTableName() + "." + "sourcechangeid" + "='"
									+ mtappVo.getParentVO().getPk_mtapp_bill() + "'";
							AggMatterAppVO[] vos = ((IErmMatterAppBillQuery) NCLocator.getInstance()
									.lookup(IErmMatterAppBillQuery.class)).queryBillByWhere(condition);
							if (vos != null && vos.length > 0) {
								AggMatterAppVO[] var10 = vos;
								int var11 = vos.length;

								for (int var12 = 0; var12 < var11; ++var12) {
									AggMatterAppVO vo = var10[var12];
									if (vo.getParentVO().getBillstatus() != -1
											&& vo.getParentVO().getApprstatus() != -1) {
										throw new BusinessException(NCLangRes4VoTransl.getNCLangRes()
												.getStrByID("201212_0", "0201212-0122"));
									}
								}
							}
						}
					}
					break;
				}

				BXBusItemVO busitemVo = var3[var5];
				if (!StringUtils.isEmpty(busitemVo.getPk_item())) {
					pk_itemSet.add(busitemVo.getPk_item());
				}

				++var5;
			}
		}

	}

	public BXBillVO submitBill(BXBillVO bill, RequestParam request) throws Exception {
		String status = (String) request.getParameter("status");
		String pk_tradetype = request.getParameter("tradetype").toString();
		String openBillId = request.getParameter("openbillid").toString();
		String ntbCheck = request.getParameter("ntbCheck").toString();
		String proBudgetCheck = (String) request.getParameter("proBudgetCheck");
		Object jkCheck = request.getParameter("jkCheck");
		String accessorybillid = (String) request.getParameter("accessorybillid");
		String msg_pk_bill = (String) request.getParameter("msg_pk_bill");
		String fromssc = (String) request.getParameter("fromssc");
		JKBXVO jkbxvo = null;
		JKBXVO[] saveResultArr = null;
		if (null != openBillId) {
			String[] pks = new String[]{openBillId};
			List<JKBXVO> bxVOList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, (String) null);
			if (ERMValueCheck.isNotEmpty(bxVOList)) {
				jkbxvo = (JKBXVO) bxVOList.get(0);
				if (jkbxvo != null) {
					if (-1 == jkbxvo.getParentVO().getDjzt()) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes()
								.getStrByID("2011005_expenseaccount_0", "02011005_expenseaccount-0023"));
					}

					this.filterBusitemVO(jkbxvo);
					this.setBillSrcSystem(jkbxvo);
					if ("true".equals(ntbCheck)) {
						jkbxvo.setHasNtbCheck(Boolean.TRUE);
					}

					if ("true".equals(proBudgetCheck)) {
						jkbxvo.setHasProBudgetCheck(Boolean.TRUE);
					}

					if ("true".equals(jkCheck)) {
						jkbxvo.setHasJkCheck(Boolean.TRUE);
					}

					jkbxvo.setHasCrossCheck(Boolean.TRUE);
					saveResultArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{jkbxvo});
				}
			}
		} else {
			doBankStatusCheck(jkbxvo);
			this.filterBusitemVO(jkbxvo);
			jkbxvo.getParentVO().setDjzt(1);
			this.setBillSrcSystem(jkbxvo);
			this.setBillStatus(jkbxvo, status);
			if ("true".equals(ntbCheck)) {
				jkbxvo.setHasNtbCheck(Boolean.TRUE);
			}

			if ("true".equals(proBudgetCheck)) {
				jkbxvo.setHasProBudgetCheck(Boolean.TRUE);
			}

			if ("true".equals(jkCheck)) {
				jkbxvo.setHasJkCheck(Boolean.TRUE);
			}

			if (!"264a".equals(pk_tradetype)) {
				this.calculateShareRatio(jkbxvo);
			}

			if ("edit".equals(status)) {
				jkbxvo.setContrastUpdate(true);
				saveResultArr = this.getIBXBillPublic().updateForWeb(new JKBXVO[]{jkbxvo});
			} else {
				if (!StringUtils.isEmpty(openBillId)) {
					jkbxvo.getParentVO().setPk_jkbx(openBillId);
				} else if (!StringUtils.isEmpty(accessorybillid)) {
					jkbxvo.getParentVO().setPk_jkbx(accessorybillid);
				}

				saveResultArr = this.getIBXBillPublic().save(new JKBXVO[]{jkbxvo});
			}
		}

		if (saveResultArr != null && saveResultArr.length > 0) {
			ERMPfUtil.doCommit(saveResultArr);
			JKBXVO returnVO = saveResultArr[0];
			ERMBillVOUtil.dealVODigit((JKBXVO) returnVO);
			new BXBillVO();
			BXBillVO resultvo = BXBillVO.getBXBillVO((JKBXVO) returnVO);
			return resultvo;
		} else {
			return null;
		}
	}

	public static void doBankStatusCheck(JKBXVO jkbxvo) throws BusinessException {
		String skyhzh = jkbxvo.getParentVO().getSkyhzh();
		if (null != skyhzh && !"".equals(skyhzh)) {
			String sql = "select b.enablestate from bd_bankaccsub a , bd_bankaccbas  b where a.PK_BANKACCBAS = b.PK_BANKACCBAS  AND a.PK_BANKACCSUB = '"
					+ skyhzh + "'";
			Object[] uObj = null;
			BaseDAO dao = new BaseDAO();
			uObj = (Object[]) ((Object[]) dao.executeQuery(sql, new ArrayProcessor()));
			if (null != uObj && uObj.length > 0) {
				Integer enablestate = (Integer) uObj[0];
				if (enablestate != 2) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("2011005_expenseaccount_0",
							"02011005_expenseaccount-0025"));
				}
			}
		}

		BXBusItemVO[] childrenVO = jkbxvo.getChildrenVO();
		if (null != childrenVO && childrenVO.length > 0) {
			Set<String> pkBankAccSet = new HashSet();
			BXBusItemVO[] var13 = childrenVO;
			int var15 = childrenVO.length;

			int var6;
			for (var6 = 0; var6 < var15; ++var6) {
				BXBusItemVO bvo = var13[var6];
				String bVoSkyhzh = bvo.getSkyhzh();
				if (null != bVoSkyhzh && !"".equals(bVoSkyhzh)) {
					pkBankAccSet.add(bVoSkyhzh);
				}
			}

			Map<String, BankAccbasVO> pksubBankAccBasMap = null;
			if (pkBankAccSet.size() > 0) {
				pksubBankAccBasMap = ((IBankaccPubQueryService) NCLocator.getInstance()
						.lookup(IBankaccPubQueryService.class)).queryBankAccBasBySubPks(
								(String[]) ((String[]) pkBankAccSet.toArray(new String[0])),
								new String[]{"enablestate"});
			}

			BXBusItemVO[] var16 = childrenVO;
			var6 = childrenVO.length;

			for (int var17 = 0; var17 < var6; ++var17) {
				BXBusItemVO bvo = var16[var17];
				String bVoSkyhzh = bvo.getSkyhzh();
				if (null != bVoSkyhzh && !"".equals(bVoSkyhzh) && pksubBankAccBasMap.containsKey(bVoSkyhzh)) {
					Integer enablestate = ((BankAccbasVO) pksubBankAccBasMap.get(bVoSkyhzh)).getEnablestate();
					if (enablestate != 2) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes()
								.getStrByID("2011005_expenseaccount_0", "02011005_expenseaccount-0025"));
					}
				}
			}
		}

	}

	public BXBillVO recallBill(RequestParam request) throws Exception {
		String openBillId = request.getParameter("openbillid").toString();
		JKBXVO returnVO = null;
		if (!StringUtil.isEmptyWithTrim(openBillId)) {
			String[] pks = new String[]{openBillId};
			List<JKBXVO> bxVOList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, (String) null);
			if (ERMValueCheck.isNotEmpty(bxVOList)) {
				if (((JKBXVO) bxVOList.get(0)).getParentVO().getSpzt() == -1) {
					throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0",
							"0expenseaccount2011-0066"));
				}

				ERMPfUtil.doRecall((AggregatedValueObject[]) bxVOList.toArray(new JKBXVO[bxVOList.size()]));
				returnVO = (JKBXVO) bxVOList.get(0);
				ERMBillVOUtil.dealVODigit(returnVO);
			}
		}

		if (returnVO != null) {
			return BXBillVO.getBXBillVO(returnVO);
		} else {
			throw new BusinessException(
					NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0", "0expenseaccount2011-0067"));
		}
	}

	public JKBillVO recallJKBill(RequestParam request) throws Exception {
		String openBillId = request.getParameter("openbillid").toString();
		JKBXVO returnVO = null;
		if (null != openBillId) {
			String[] pks = new String[]{openBillId};
			List<JKBXVO> bxVOList = this.getIBXBillPrivate().queryVOsByPrimaryKeys(pks, (String) null);
			if (ERMValueCheck.isNotEmpty(bxVOList)) {
				ERMPfUtil.doRecall((AggregatedValueObject[]) bxVOList.toArray(new JKBXVO[bxVOList.size()]));
				returnVO = (JKBXVO) bxVOList.get(0);
				ERMBillVOUtil.dealVODigit(returnVO);
			}
		}

		if (returnVO != null) {
			return JKBillVO.getJKBillVO(returnVO);
		} else {
			throw new BusinessException(
					NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0", "0expenseaccount2011-0067"));
		}
	}

	public ERMReimResultVO[] loadReim(JKBXVO billvo, String pagecode, String appcode, int changrownum,
			Map<String, List<SuperVO>> resultReimDimData, String templateId) throws Exception {
		List<ERMReimResultVO> reimResult = new ArrayList();
		ERMReimResultVO bodyReim = (new ERMReimRuleUtil()).doBodyReimAction(pagecode, appcode, billvo, changrownum,
				resultReimDimData, templateId);
		if (bodyReim != null) {
			reimResult.add(bodyReim);
		}

		return (ERMReimResultVO[]) reimResult.toArray(new ERMReimResultVO[reimResult.size()]);
	}

	public Object[] getReimDimList(JKBXVO billvo, Map<String, List<SuperVO>> resultReimDimData) throws Exception {
		String djlxbm = (String) billvo.getParentVO().getAttributeValue("djlxbm");
		String pk_org = (String) billvo.getParentVO().getAttributeValue("pk_org");
		String pk_group = (String) billvo.getParentVO().getAttributeValue("pk_group");
		Object[] arr = (new ERMReimRuleUtil()).getReimDimList(djlxbm, pk_org, pk_group, resultReimDimData);
		return arr;
	}

	public BXBusItemVO[] converXlsToBusitemVO(Sheet effectRows,
			CopyOnWriteArrayList<com.alibaba.fastjson.JSONObject> colsMap, String pk_org, boolean isUseName)
			throws BusinessException {
		if (effectRows != null && effectRows.getLastRowNum() != 0) {
			List<String> typelist = new ArrayList();
			Iterator var6 = colsMap.iterator();

			while (var6.hasNext()) {
				com.alibaba.fastjson.JSONObject vo = (com.alibaba.fastjson.JSONObject) var6.next();
				String type = vo.getString("mdid");
				typelist.add(type);
			}

			BaseDAO dao = new BaseDAO();
			String sql = "select id , fullclassname from md_class where  " + SqlUtils.getInStr("id", typelist, false);
			List metainfo = (List) dao.executeQuery(sql, new ArrayListProcessor());
			Iterator iterator = metainfo.iterator();
			HashMap metamap = new HashMap();

			while (true) {
				Object[] row;
				do {
					do {
						if (!iterator.hasNext()) {
							BXBusItemVO[] result = new BXBusItemVO[effectRows.getLastRowNum()];

							for (int i = 0; i < effectRows.getLastRowNum(); ++i) {
								result[i] = new BXBusItemVO();
								Row row1 = effectRows.getRow(i + 1);

								for (int j = 0; j < row1.getLastCellNum(); ++j) {
									if (colsMap.get(j) != null) {
										Object cellValue = "";
										if (row1.getCell(j) != null) {
											if (CellType.NUMERIC == row1.getCell(j).getCellType()) {
												cellValue = row1.getCell(j).getNumericCellValue();
											} else {
												cellValue = row1.getCell(j).getStringCellValue();
											}
										}

										if (cellValue != null && !cellValue.equals("")) {
											String defcode = "";

											try {
												defcode = ((com.alibaba.fastjson.JSONObject) colsMap.get(j))
														.getString("key");
												if (!((com.alibaba.fastjson.JSONObject) colsMap.get(j))
														.getString("datatype").equals("31")
														&& !((com.alibaba.fastjson.JSONObject) colsMap.get(j))
																.getString("datatype").equals("2")
														&& !((com.alibaba.fastjson.JSONObject) colsMap.get(j))
																.getString("datatype").equals("52")) {
													if (((com.alibaba.fastjson.JSONObject) colsMap.get(j))
															.getString("datatype").equals("4")) {
														int amount = 0;
														if (!cellValue.toString().trim().equals("")) {
															amount = Integer.valueOf(cellValue.toString().trim());
														}

														result[i].setAttributeValue(defcode, amount);
														result[i].setAttributeValue(defcode + "_name",
																String.valueOf(amount));
													} else if (!((com.alibaba.fastjson.JSONObject) colsMap.get(j))
															.getString("datatype").equals("1")
															&& !((com.alibaba.fastjson.JSONObject) colsMap.get(j))
																	.getString("datatype").equals("56")) {
														String currSql;
														List bzbmList;
														String classid;
														String fieldWherePart;
														String[] arr;
														String fieldWherePart1;
														if (!((com.alibaba.fastjson.JSONObject) colsMap.get(j))
																.getString("itemtype").equalsIgnoreCase("select")) {
															IGeneralAccessor ga = GeneralAccessorFactory.getAccessor(
																	((com.alibaba.fastjson.JSONObject) colsMap.get(j))
																			.getString("mdid"));
															Object[] objects;
															if (ga instanceof BankaccSubGeneralAccessor) {
																currSql = "select pk_bankaccsub from bd_bankaccsub where accname = '"
																		+ cellValue + "'";
																bzbmList = (List) ((IUAPQueryBS) NCLocator.getInstance()
																		.lookup(IUAPQueryBS.class)).executeQuery(
																				currSql, new ArrayListProcessor());
																if (bzbmList != null && bzbmList.size() > 0) {
																	objects = (Object[]) bzbmList.get(0);
																	result[i].setAttributeValue(defcode, objects[0]);
																	result[i].setAttributeValue(defcode + "_name",
																			cellValue.toString().trim());
																}
															} else {
																SuperVO[] value;
																String attrname;
																if (!(ga instanceof NullGeneralAccessor)
																		&& !(ga instanceof CurrtypeGeneralAccessor)) {
																	currSql = null;
																	value = null;
																	if (cellValue != null) {
																		IBDData docvo;
																		if (isUseName) {
																			docvo = ga.getDocByNameWithMainLang(pk_org,
																					(String) cellValue);
																		} else {
																			docvo = ga.getDocByCode(pk_org,
																					(String) cellValue);
																		}

																		if (docvo == null) {
																			classid = ((com.alibaba.fastjson.JSONObject) colsMap
																					.get(j)).getString("mdid");
																			Class claz = Class.forName(
																					((com.alibaba.fastjson.JSONObject) colsMap
																							.get(j)).getString(
																									"classid"));
																			attrname = "";
																			arr = new String[]{classid};
																			IMetaQueryService metaService = (IMetaQueryService) NCLocator
																					.getInstance()
																					.lookup(IMetaQueryService.class);
																			Map<String, Map<String, String>> map = metaService
																					.queryCodeAndNameByClassid(arr);
																			if (null != map) {
																				if (isUseName) {
																					attrname = (String) ((Map) map
																							.get(classid)).get("name");
																				} else {
																					attrname = (String) ((Map) map
																							.get(classid)).get("code");
																				}
																			}

																			String groupId = InvocationInfoProxy
																					.getInstance().getGroupId();
																			fieldWherePart1 = null;
																			fieldWherePart1 = attrname + " = '"
																					+ cellValue.toString() + "'";
																			String groupWherePart = " and pk_group = '"
																					+ groupId + "'";
																			String wherePart = fieldWherePart1
																					+ groupWherePart;
																			value = CacheUtil
																					.getValueFromCacheByWherePart(claz,
																							wherePart);
																		}

																		if (value != null && value.length > 0) {
																			result[i].setAttributeValue(defcode,
																					value[0].getPrimaryKey());
																			result[i].setAttributeValue(
																					defcode + "_name",
																					cellValue.toString().trim());
																		}

																		if (docvo != null) {
																			result[i].setAttributeValue(defcode,
																					docvo.getPk());
																			result[i].setAttributeValue(
																					defcode + "_name",
																					cellValue.toString().trim());
																		}
																	}
																} else if (ga instanceof CurrtypeGeneralAccessor) {
																	currSql = "select pk_currtype from bd_currtype where name = '"
																			+ cellValue + "'";
																	bzbmList = (List) ((IUAPQueryBS) NCLocator
																			.getInstance().lookup(IUAPQueryBS.class))
																					.executeQuery(currSql,
																							new ArrayListProcessor());
																	if (bzbmList != null && bzbmList.size() > 0) {
																		objects = (Object[]) bzbmList.get(0);
																		result[i].setAttributeValue(defcode,
																				objects[0]);
																		result[i].setAttributeValue(defcode + "_name",
																				cellValue.toString().trim());
																	}
																} else {
																	Class claz = Class.forName(
																			((com.alibaba.fastjson.JSONObject) colsMap
																					.get(j)).getString("classid"));
																	bzbmList = null;
																	classid = InvocationInfoProxy.getInstance()
																			.getGroupId();
																	fieldWherePart1 = null;
																	if (isUseName) {
																		fieldWherePart1 = "name = '"
																				+ cellValue.toString() + "'";
																	} else {
																		fieldWherePart1 = "code = '"
																				+ cellValue.toString() + "'";
																	}

																	attrname = " and pk_group = '" + classid + "'";
																	if (ga instanceof CurrtypeGeneralAccessor) {
																		attrname = "";
																	}

																	String wherePart = fieldWherePart1 + attrname;
																	value = CacheUtil.getValueFromCacheByWherePart(claz,
																			wherePart);
																	if (value != null && value.length > 0) {
																		result[i].setAttributeValue(defcode,
																				value[0].getPrimaryKey());
																		result[i].setAttributeValue(defcode + "_name",
																				cellValue.toString().trim());
																	}
																}
															}
														} else {
															String pkFormProperty = ((com.alibaba.fastjson.JSONObject) colsMap
																	.get(j)).getString("mdid");
															currSql = "select showdataval from pub_form_property where pk_form_property = '"
																	+ pkFormProperty + "'";
															bzbmList = (List) ((IUAPQueryBS) NCLocator.getInstance()
																	.lookup(IUAPQueryBS.class)).executeQuery(currSql,
																			new ArrayListProcessor());
															classid = "";
															fieldWherePart1 = "";
															if (bzbmList != null && bzbmList.size() > 0) {
																Object[] objects = (Object[]) bzbmList.get(0);
																arr = objects[0].toString().split(",");
																String[] var24 = arr;
																int var25 = arr.length;

																for (int var26 = 0; var26 < var25; ++var26) {
																	fieldWherePart1 = var24[var26];
																	if (null != fieldWherePart1 && fieldWherePart1
																			.contains(cellValue.toString())) {
																		String[] itemSplit = fieldWherePart1.split("=");
																		fieldWherePart1 = itemSplit[1];
																	}
																}

																result[i].setAttributeValue(defcode, fieldWherePart1);
																result[i].setAttributeValue(defcode + "_name",
																		cellValue.toString().trim());
															}
														}
													} else {
														result[i].setAttributeValue(defcode,
																cellValue.toString().trim());
														result[i].setAttributeValue(defcode + "_name",
																cellValue.toString().trim());
													}
												} else {
													UFDouble amount = UFDouble.ZERO_DBL;
													if (!cellValue.toString().trim().equals("")) {
														amount = new UFDouble(
																Double.parseDouble(cellValue.toString().trim()));
													}

													result[i].setAttributeValue(defcode, amount);
													result[i].setAttributeValue(defcode + "_name", amount.toString());
												}
											} catch (Exception var30) {
												ExceptionHandler.consume(var30);
											}
										}
									}
								}
							}

							return result;
						}

						row = (Object[]) ((Object[]) iterator.next());
					} while (row == null);
				} while (row.length == 0);

				metamap.put(row[0], row[1]);
				Iterator var12 = colsMap.iterator();

				while (var12.hasNext()) {
					com.alibaba.fastjson.JSONObject vo = (com.alibaba.fastjson.JSONObject) var12.next();
					if (!vo.containsKey("mdid")) {
						throw new BusinessException(NCLangRes4VoTransl.getNCLangRes().getStrByID("expenseaccount2011_0",
								"0expenseaccount2011-0099", (String) null, new String[]{vo.getString("label")}));
					}

					if (vo.getString("mdid").equals(row[0].toString())) {
						vo.put("classid", row[1]);
					}
				}
			}
		} else {
			return new BXBusItemVO[0];
		}
	}

	public JKBXVO completMtappInfo(JKBXVO bill) throws Exception {
		return (new ExpenseaccountCompleteSqInfoHelper()).completMtappInfo(bill);
	}

	@Override
	public CShareDetailVO[] converXlsToCShareDetailVO(Sheet arg0,
			CopyOnWriteArrayList<com.alibaba.fastjson.JSONObject> arg1, String arg2, boolean arg3)
			throws BusinessException {
		// TODO Auto-generated method stub
		return null;
	}
}